Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable publication at crates.io #98

Conversation

chrysn
Copy link
Collaborator

@chrysn chrysn commented Sep 28, 2023

For exploring this crate, it would be helpful if it were uploaded to crates.io.

I've started adding a few version numbers in dependencies to make that work, but there are some showstoppers along the way which I'd like to track here:

  • Crypto thvdveld/cc2538-hal#2
  • The published version of psa-crypto has no baremetal feature:
    error: failed to verify package tarball
    
    Caused by:
      failed to select a version for `psa-crypto`.
          ... required by package `edhoc-crypto-psa v0.1.0 (/home/chrysn/.cache/cargo-target/package/edhoc-crypto-psa-0.1.0)`
      versions that meet the requirements `^0.9.2` are: 0.9.2
    
      the package `edhoc-crypto-psa` depends on `psa-crypto`, with features: `baremetal` but `psa-crypto` does not have these features.
    
    
      failed to select a version for `psa-crypto` which could resolve this conflict
    
    (My guess is that that is a check that only happens when the feature is selected, and it didn't get selected during builds?)

This PR should contain valid changes with our without fixes to the above; once all of those are in, I'd appreciate if the maintainers would consider publication, as it helps with visibility and makes the documentation accessible more easily. (It'd also help dependent projects in their own publication, but I'm not at the point yet where I have something there).

This will enable crates.io publication once
thvdveld/cc2538-hal#2 is published (and the
cc2538-hal dependency line updated).
@malishav
Copy link
Contributor

This would be absolutely great but I am afraid there are several showstoppers ATM. Some comments:

  • To have PSA build working we had to make some patches to the repository and we are using a fork. The patches have not been proposed upstream. @kaspar030 worked on this so could complement me.
  • hacspec implementation of AES-CCM is also in a fork that has not been merged upstream.
  • Unless you have a compelling reason not to, we plan to abandon support for CC2538, so this should tick one of your boxes.

chrysn added a commit to chrysn-pull-requests/edhoc-rs that referenced this pull request Sep 29, 2023
chrysn added a commit to chrysn-pull-requests/edhoc-rs that referenced this pull request Sep 29, 2023
@chrysn
Copy link
Collaborator Author

chrysn commented Sep 29, 2023

Hm ... it's certainly inconvenient when optional dependencies are not published, as crates.io doesn't allow them to be second-class.

A workflow I've been using in riot-wrappers a lot was to have a release mode where I'd commit a change that comments out all the optional stuff that's not published yet, then bump the version, publish, and revert the commenting-out commit right away. It's not pretty, but it works as soon as there is one back-end that is published. (And if it's not cc2538, I figure that Rust software implementations of crypto would sooner or later be on the menu, as they'd enable using this efficiently on x86 and WASM).

On the long run, is there a plan for how the backends could become decoupled? A model that has worked well for libOSCORE, albeit on the C side but with a very Rust mindset, was that the published library just depends on the platform to provide an implementation of the backend interface, and then some back-ends could be available via crates.io, while others wait for upstreams to be publishable.

@geonnave
Copy link
Collaborator

geonnave commented Oct 6, 2023

Just leaving a thought here, me and @malishav discussed over lunch today and we see the following possible paths to enable publication at crates.io:

  • Try to upstream all changes relating to the psa crypto backend
  • Find a set of pure Rust libraries that are no_std (and preferably stack-only), essentially creating a new "pure-rust" crypto backend and deprecating psa

@chrysn
Copy link
Collaborator Author

chrysn commented Oct 7, 2023

Is the #103 approach not viable? That would allow easily keeping backends around that are not fully on crates (PSA is surely nice to have).

@malishav
Copy link
Contributor

malishav commented Oct 8, 2023

Is the #103 approach not viable? That would allow easily keeping backends around that are not fully on crates (PSA is surely nice to have).

I am missing how #103 enables publication. Won't we still need a patched dependency to these crates (hacspec, PSA)? Could you elaborate?

@chrysn
Copy link
Collaborator Author

chrysn commented Oct 8, 2023 via email

@geonnave
Copy link
Collaborator

geonnave commented Oct 9, 2023

I had the same question as Malisa's, now I understand better. The changes on #103 are looking good and also #115 puts us a little bit closer to achieving this.

@geonnave geonnave added the enhancement New feature or request label Oct 9, 2023
@chrysn
Copy link
Collaborator Author

chrysn commented Nov 15, 2023

This will need a complete redo with the latest main branch, but after #139, all dependencies should be shippable.

We may want to not hurry this, because I think that a few refactorings might bring the number of published crates down (so by not going to crates.io right away we avoid having some linger forever in 0.4): if we follow up on the hackathon plan based on Marco's designs, I think we won't need the 3 EAD crates in the dependency tree any more, and the consts can go into the main library.

@chrysn
Copy link
Collaborator Author

chrysn commented Dec 14, 2023

Closing as obsolete with the publications around 0.4.0.

@chrysn chrysn closed this Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants